﻿@using Easy.Web.CMS
@using Easy.Web.CMS.Widget
@model DesignWidgetViewModel
<div style="@Model.Widget.CustomStyle">
    <div class="widget widget-design @Model.Widget.CustomClass"
         id="widget_@Model.Widget.ID"
         data-widgetid="@Model.Widget.ID">
        <div class="zoneToolbar @(Model.Widget.LayoutID.IsNullOrEmpty() ? "blue" : "green")">
            <div class="tools">
                <i class="glyphicon glyphicon-move sort-handle">
                </i>
                <a href="@Url.Action("Edit", "Widget", new {module = "admin", ID = Model.Widget.ID, ReturnUrl = Url.Action("Design", "Page", new {ID = Model.PageID})})"><i class="glyphicon glyphicon-edit"></i></a>
                <a href="javascript:void(0)" class="delete"
                   data-url="@Url.Action("DeleteWidget", "Widget", new {module = "admin"})"
                   data-id="@Model.Widget.ID"><i class="glyphicon glyphicon-trash"></i></a>
                @if (Model.Widget.LayoutID.IsNotNullAndWhiteSpace())
                {
                    <span class="badge">布局</span>
                }
                @Model.Widget.WidgetName
            </div>
        </div>
        @if (Model.Widget.Title.IsNotNullAndWhiteSpace())
        {
            <div class="panel panel-default">
                <div class="panel-heading">
                    @Model.Widget.Title
                </div>
                <div class="panel-body">
                    @Html.DisPlayWidget(Model)
                </div>
            </div>
        }
        else
        {
            @Html.DisPlayWidget(Model)
        }
    </div>
</div>